package test.digester;

import java.util.ArrayList;
import java.util.List;

public class Employee {
    private String firstName;
    private String lastName;
    private List<Office> offices = new ArrayList<>();
    public Employee() {
        System.out.println("创建Employee对象");
    }

    public String getFirstName() {
        return firstName;
    }

    public void setFirstName(String firstName) {
        System.out.println("设置firstName : " + firstName);
        this.firstName = firstName;
    }

    public String getLastName() {
        return lastName;
    }

    public void setLastName(String lastName) {
        System.out.println("设置lastName : " + lastName);
        this.lastName = lastName;
    }

    public void addOffice(Office office) {
        System.out.println("添加Office" + office);
        offices.add(office);
    }

    public List<Office> getOffices() {
        return offices;
    }

    public void print() {
        System.out.println(toString());
    }

    @Override
    public String toString() {
        return "Employee{" +
                "firstName='" + firstName + '\'' +
                ", lastName='" + lastName + '\'' +
                ", offices=" + offices +
                '}';
    }
}
